<?php
function slug($Text) {
	$_Replace = array(
	"ğ"=>"g", 
	"ü"=>"u",
	"ş"=>"s",
	"ç"=>"c",
	"ö"=>"o",
	"ı"=>"i",
	"â"=>"a",
	"û"=>"u",

	"Ğ"=>"g",
	"Ü"=>"u",
	"Ş"=>"s",
	"Ç"=>"c",
	"Ö"=>"o",
	"İ"=>"i",
	"î"=>"i",
	
	"?"=>"-",
	"!"=>"-",
	"."=>"-",
	","=>"",
	"("=>"",
	")"=>"",
	"'"=>"",
	"\""=>"",
	"/"=>""
	);

	// strip all non word chars
    $text = strtolower(str_replace(array_keys($_Replace), array_values($_Replace), $Text));
    // replace all white space sections with a dash
    $text = preg_replace('/\ +/', '-', $text);

    // trim dashes
    $text = preg_replace('/\-$/', '', $text);
    $text = preg_replace('/^\-/', '', $text);
	return $text;
}

function stripBBCode($text_to_search) {
	$pattern = '|[[\/\!]*?[^\[\]]*?]|si';
	$replace = '';
	return preg_replace($pattern, $replace, $text_to_search);
}

function trimString($input, $string) {
        $input = trim($input);
        $string = str_replace("\\", "\\\\", $string);
        $string = str_replace('/', '\\/', $string);
        $startPattern = "/^($string)+/i";
        $endPattern = "/($string)+$/i";
        return trim(preg_replace($endPattern, '', preg_replace($startPattern,'',$input)));
}

?>